package com.jiazhong.shixi.caichanguanli.mapper;

import com.jiazhong.shixi.caichanguanli.bean.WorkOrders;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface WorkOrdersMapper {
    @Insert("INSERT INTO work_orders(work_order_id,work_details, create_time, repair_id) " +
            "VALUES(#{workOrderId},#{workDetails}, now(), #{repairId})")
    int insert(WorkOrders order);

    @Select("SELECT * FROM work_orders  order by create_time desc  ")
    List<WorkOrders> findByFreshOrder();

    @Select("SELECT * FROM work_orders  order by create_time desc  limit 0,5 ")
    List<WorkOrders> findByFresh();

    @Delete("DELETE FROM work_orders WHERE work_order_id = #{workOrderId}")
    int deleteById(WorkOrders order);
}
